import React, {FC} from "react";
import {QuestionTitleProsTpye,QuestionProsType} from "./interface";

import {Typography} from "antd";


const {Title} =Typography;
const QuestionTitle:FC<QuestionTitleProsTpye> = (props:QuestionTitleProsTpye) => {

    const {title='',isCenter=false,level=1} = {...QuestionProsType,...props};

    const genSize = (level:number) => {
        switch (level) {
            case 1:
                return "24px";
            case 2:
                return "18px";
            case 3:
                return "14px";
            default:
                return "18px";
        }
    }

    return (
           <Title level={level} style={{textAlign:isCenter?"center":"start",
           marginBottom:'0',
               fontSize:genSize(level),
           }}>
               {title}
           </Title>
    );
}
export default QuestionTitle;